package com.zhangx.datastructure.sort;

import java.util.Arrays;

/**
 * @ClassName SqList
 * @Description 顺序表结构
 * @Author zhangx
 * @Date 2021/2/2 9:31
 **/
public class SqList {

    public int MAXSIZE = 10;
//    r0是哨兵或者临时变量
    public int[] r = new int[MAXSIZE+1];
//    顺序表长度
    public int length = 10;

    /**
     * 交换
     * @param l
     * @param i
     * @param j
     */
    void swap(SqList l,int i,int j){
        int tmp = l.r[i];
        l.r[i] = l.r[j];
        l.r[j] = tmp;
    }

    @Override
    public String toString() {
        return "SqList{" +
                "MAXSIZE=" + MAXSIZE +
                ", r=" + Arrays.toString(r) +
                ", length=" + length +
                '}';
    }
}
